# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libxml++
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.2.5
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
pkgdesc="C++ wrapper for the libxml2 XML parser library (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-libxml2"
         "${MINGW_PACKAGE_PREFIX}-glibmm")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-doxygen"
             "${MINGW_PACKAGE_PREFIX}-graphviz"
             "${MINGW_PACKAGE_PREFIX}-libxslt"
             "${MINGW_PACKAGE_PREFIX}-docbook-xsl"
             "${MINGW_PACKAGE_PREFIX}-pkgconf")
license=('spdx:LGPL-2.0-or-later')
url="https://libxmlplusplus.github.io/libxmlplusplus/"
msys2_repository_url="https://github.com/libxmlplusplus/libxmlplusplus"
source=("https://download.gnome.org/sources/${_realname}/${pkgver%.*}/${_realname}-${pkgver}.tar.xz")
sha256sums=('0c9b381b5a83d6b3ab4b0b865d7256dab27d575981b63be2f859edcb94da59c7')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
}

build() {
  mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  meson \
      --prefix="${MINGW_PREFIX}" \
      --buildtype plain \
      --auto-features=enabled \
      -Dbuild-documentation=true \
      -Dbuild-examples=false \
      ../${_realname}-${pkgver}

  meson compile
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"
  DESTDIR="${pkgdir}" meson install

  install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
